public class VolatileVisibility {
    public static  int i = 0;

    public synchronized static void increase() {
        i++;
    }

    public  static void checkI() {
        System.out.println(i);
    }

    public static void main(String[] args) {
        Thread t = new Thread(() -> {
            increase();
        });
        Thread t2 = new Thread(() -> {
            checkI();
        });


        t.start();
        t2.start();
    }

}
